package com.hsp.Demo_02_array;

public class Demo_10 {
    public static void main(String[] args) {
        /*
            杨辉三角
            1
            1   1
            1   2   1
            1   3   3   1
            1   4   6   4   1
            1   5   10  10  5   1
            1   6   15  20  15  6   1
            ***

         */
        int[][] arr = new int[10][];

        for(int i = 0; i < arr.length; i++){
            arr[i] = new int[i+1];
            for(int j = 0; j < arr[i].length; j++){
                if(j == 0 || j == arr[i].length -1){
                    arr[i][j] = 1;
                }else{
                    arr[i][j] = arr[i-1][j-1] + arr[i-1][j];
                }
            }
        }

        for(int i = 0; i < arr.length; i++){
            for(int j = 0; j < arr[i].length; j++){
                System.out.print(arr[i][j] + "\t");
            }
            System.out.println();
        }
    }
}
